/**
 * Created by Robin on 2016/7/29.
 */
app.directive('loading', function() {
    return {
        restrict : 'A',
        replace : true,
        transclude : true,
        scope : {
            loading : '=state'
        },
        template : '<div>'
        + '<div style="position:relative;height:300px" ng-show="loading"><div class="loader"></div></div>'
        + '<div class="body" ng-class="{true:innerClass}[hasInner]" ng-show="!loading" ng-transclude></div>'
        + '</div>',
        link: function(scope, element, attributes) {
            if(attributes.inClass){
                scope.innerClass = attributes.inClass;
                scope.hasInner = true;
            }
        }
    }
});